
targetted_decisions = {

	adopt_decision = {
		filter = home_court
		ai_target_filter = home_court #ROOT = { host = { character = FROM } }.          .
		from_potential = { # - ,   decision, decision_taker
			OR = {
				ai = no
				AND = {
					OR = {
						trait = eunuch # ,
						trait = sterillity # ,
						AND = { is_female = no age = 55 } #   .
						AND = { is_female = yes age = 45 } #   .
					}
					NOR = { #    ( )    
						AND = { #      
							NOR = { #  ,     agnatic_succession,     ,   -  
								has_law = cognatic_succession
								has_law = true_cognatic_succession
								has_law = enatic_cognatic_succession
								has_law = enatic_succession
							}
							any_child = { is_female = no } # - 
						}
						AND = { #        
							OR = {
								has_law = cognatic_succession
								has_law = true_cognatic_succession
								has_law = enatic_cognatic_succession
							}
							any_child = { always = yes } # -   
						}
						AND = { #      
							has_law = enatic_succession
							any_child = { is_female = yes } # - 
						}
					}
				}
			}
			is_ruler = yes #  (     )
			is_adult = yes # 
			prisoner = no #  
			NOT = { trait = incapable }
			NOT = { trait = on_hajj }
			NOT = { trait = on_pilgrimage }
			has_regent = no #   
		}
		
		potential = { #  - ,    decision, decision_target
			NOT = { dynasty = FROM } # 
			is_adult = no #
			age_diff = { who = FROM years = 13 } #   13   ,    ,  16-   15-.
			host = { character = FROM } #    
			OR = {
				employer = { character = FROM } #   ,    
				prisoner = yes #     (        opinion)
			}
		}
		allow = {
			OR = {
				FROM = { any_spouse = { #     ( ),   ().  ()   ()
					ROOT = { is_child_of = PREV NOT = { dynasty = PREV } } # ,     () .
					OR = {
						AND = {
							is_female = yes
							ROOT = { NOT = { father = { is_alive = yes } } }
						}
						AND = {
							is_female = no
							ROOT = { NOT = { mother = { is_alive = yes } } }
						}
					}
				} }
				AND = { #   
					OR = { # opinion ,   
						NOT = { mother = { is_alive = yes } }
						mother = {
							opinion = { who = FROM value = 70 }
							OR = { is_ruler = no ROOT = { NOT = { dynasty = PREV } } }
						}
					}
					OR = { #  opinion ,   
						NOT = { father = { is_alive = yes } }
						father = {
							opinion = { who = FROM value = 70 }
							OR = { is_ruler = no ROOT = { NOT = { dynasty = PREV } } }
						}
					}
					OR = { #    ,      opinion (    ,   )
						father = { is_alive = yes }
						mother = { is_alive = yes }
						opinion = { who = FROM value = 100 }
					}
				}
			}
			FROM = {
				prestige = 200
				piety = 200
			}
		}

		effect = {
			FROM = { prestige = -200 } #  
			dynasty = FROM #ROOT,   ,   
			if = { limit = { prisoner = yes } #     ,
				prisoner = no } #   
			if = { limit = { FROM = { is_female = no } } #  ,
				set_father = FROM } #    
			if = { limit = { FROM = { is_female = yes } } # ,
				set_mother = FROM } # .
			add_trait = legit_bastard #   " "
			hidden_tooltip = { recalc_succession = yes FROM = { recalc_succession = yes } } #         .
			FROM = {
				any_spouse = { limit = { NOT = { any_child = { character = ROOT } } } #  /   ,     .
					opinion = {
						who = FROM
						modifier = legitimized_bastard
						years = 20
					}
				}
				any_child = { #   ,   ,   .
					limit = {
						NOT = { character = ROOT }
						dynasty = PREV
						NOT = { trait = bastard }
					}
					opinion = {
						who = PREV
						modifier = legitimized_bastard
						years = 20
					}
				}
				any_dynasty_member = { #       ,
					limit = { NOR = { #     ,    
						is_child_of = PREV
						any_spouse = { character = PREVPREV }
					} }
					opinion = {
						who = PREV
						modifier = legitimized_bastard
						years = 2
					}
				}
			}
		}
		ai_will_do = { factor = 1
			modifier = { factor = 0.2 }
		}
	}
}